<?php

//排名监控 - 添加关键词
function jqcpm_add($sid,$key,$domain){
	$data = [];
	$uid = config('JQ_UID');
	$token = config('JQ_KEY');
	//sid 为客户系统搜索引擎标识id
	switch($sid){
		case 1010:
			$sid2 = 101;//百度
			break;
		case 1015:
			$sid2 = 102;//360
			break;
		case 1030:
			$sid2 = 103;//搜狗
			break;
		case 7010:
			$sid2 = 201;//百度移动
			break;
		case 7015:
			$sid2 = 202;//360移动
			break;
		case 7030:
			$sid2 = 203;//搜狗移动
			break;
		case 7070:
			$sid2 = 204;//神马
			break;
		case 7080:
			$sid2 = 205;//头条
			break;
	}
	
	$data = [
		'uid' => $uid,
		'token' => $token,
		'key' => $key,
		'domain' => $domain,
		'sid' => $sid2,
		'token' => $token,
		'jktime' => 6, //监控开始时间
		'cxtype' => 1,//监控查询
		'diqu' => 0,//地区目前只有一个
		'gid' => 102,//分组id,后台自己先添加
	];
	
	
	$url = "http://api.xseo.vip:8910/api/cpm/add";
	$res = http_request($url,$data);
	return $res;
	
	/*
	结果json格式:  
	成功  ['code'=>1,'tid'=>$tid];    请记录tid,方便删除操作
	失败  ['code'=>0,'msg'=>"添加失败"]
	*/
	
}
//排名监控-删除
function jqcpm_del($tids){
	$data = [];
	$uid = config('JQ_UID');
	$token = config('JQ_KEY');
	
	$data = [
		'uid' => $uid,
		'token' => $token,
		'tids' => $tids, 
	];
	
	$url = "http://api.xseo.vip:8910/api/cpm/del";
	$res = http_request($url,$data);
	return $res;
	
	//结果json:['code'=>1,'msg'=>"success"]; 0失败1成功
}


//排名监控 - 获取用户信息

function jqcpm_uinfo(){
	$data = [];
	$uid = config('JQ_UID');
	$token = config('JQ_KEY');
	
	$data = [
		'uid' => $uid,
		'token' => $token,
	];
	
	$url = "http://api.xseo.vip:8910/api/cpm/uinfo";
	$res = http_request($url,$data);
	return $res;
	
	//返回结果json :['count'=>总关键词数,'c1'=>待查询数,'c2'=>待推送数];
	
}